{% extends 'layout/main.html' %}
{% from 'bootstrap/pagination.html' import render_pagination %}
{% block content_header %}
    <h1>
      用户管理
    </h1>
    <ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
    <li><a href="#">Examples</a></li>
    <li class="active">Blank page</li>
    </ol>
{% endblock %}


{% block content %}
    <div class="box">
        <div class="box-header with-border">
            <h3 class="box-title">用户列表</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
            <table class="table table-bordered table-striped">
              <thead>
                <tr>
                  <th style="width: 10px">#</th>
                  <th>账号</th>
                  <th>真实姓名</th>
                  <th>最后登陆IP</th>
                  <th>注册时间</th>
                  <th style="width: 40px">操作</th>
                </tr>
              </thead>
              <tbody>
                {% if model %}
                {% for item in model %}
                <tr>
                  <td>{{ loop.index }}</td>
                  <td>{{ item.username }}</td>
                  <td>{{ item.nickname }}</td>
                  <td>{{ item.last_ip | strftime }}</td>
                  <td>{{ item.last_login_at.strftime('%Y-%m-%d %H:%M:%S') }}</td>
                  <td style="width:100px">
                    <a href=""><span class="glyphicon glyphicon-user"></span></a>
                    <a href="{{ url_for('users.update', id=item.id) }}"><span class="glyphicon glyphicon-pencil"></span></a>
                    <a href="{{ url_for('users.delete', id=item.id) }}"><span class="glyphicon glyphicon-trash"></span></a>
                  </td>
                </tr>
                {% endfor %}
                {% endif %}
              </tbody>
            </table>
        </div>
        <!-- /.box-body -->
        <div class="box-footer clearfix">
          <div class="pagination pagination-sm no-margin pull-right">
            {{ render_pagination(pagination) }}
          </div>
        </div>
    </div>
{% endblock %}
